import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String b = sc.nextLine();
        int maxn = -1;
        int [][]dp = new int [100][100];
        for(int i = 0;i < a.length();i ++){
            for(int j = 0;j < b.length();j ++){
                if(a.charAt(i) == b.charAt(j)){
                    if(i > 0 && j > 0){
                        dp[i][j] = dp[i - 1][j - 1] + 1;
                    }else{
                        dp[i][j] = 1;
                    }
                }
                if(maxn < dp[i][j]){
                    maxn = dp[i][j];
                }
            }
        }
        System.out.println(maxn);
    }
}
